<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>链表的中间节点</title>
</head>
<body>
  <script>
    function fn(head) {
      if (!head.next) return null
      let a = head, b = head, c = null
      while (a && a.next) {
        c = b
        b = b.next
        a = a.next.next
      }
      c.next = c.next.next
      return head
    }
    console.log(fn([1, 2, 3, 4, 5]))
  </script>
</body>
</html>